home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 1
/
Gekikoh Dennoh Club Vol. 1 (Japan).7z
/
Gekikoh Dennoh Club Vol. 1 (Japan) (Track 1).bin
/
tools
/
cdc
/
src
/
scsic.s
< prev
next >
Wrap
Text File
|
1997-05-29
|
11KB
|
654 lines
**************************************************
*
* コマンド実行
*
*
**************************************************
.globl _scsi_cmd
_scsi_cmd:
link a6,#-4
move.w #1,_ScscUse
movem.l a1/d3-d6,-(sp)
suba.l a1,a1
IOCS _B_SUPER
move.l d0,-(sp)
tst.w _DiSwc
beq @f
move.w sr,-(sp)
DI
@@:
move.w $0a0e.w,-(sp) *現在処理中のIOCSコール番号(なければ-1)
move.w #$00F5,$0a0e.w *現在処理中のIOCSコール番号(なければ-1)
move.l _SCSI_IDF,d4
SCSI__ _S_SELECT
tst.l d0
beq @f
moveq #-4,d0 *エラー
bra 1f
@@:
movea.l 12(a6),a1
move.l 8(a6),d3
move.b _SCSI_LUN,d0 **
andi.b #$1F,1(a1) **
or.b d0,1(a1) **
SCSI__ _S_CMDOUT
tst.l d0
beq @f
moveq #-3,d0 *エラー
bra 1f
@@:
move.l 16(a6),d3 *データは欲しがっているか?
tst.l d3
beq @f
*move.l 16(a6),d3
movea.l 20(a6),a1
SCSI__ _S_DATAIN_P
tst.l d0
bpl @f
lea -1(a6),a1
SCSI__ _S_STSIN
SCSI__ _S_MSGIN
moveq #-5,d0 *エラー
bra 1f
@@:
lea -1(a6),a1
SCSI__ _S_STSIN
tst.l d0
beq @f
moveq #-2,d0 *エラー
bra 1f
@@:
lea -3(a6),a1
SCSI__ _S_MSGIN
tst.l d0
beq @f
moveq #-1,d0 *エラー
bra 1f
@@:
moveq #0,d0
move.b -3(a6),d0
swap d0
move.b -1(a6),d0
1:
move.w (sp)+,$0a0e.w *現在処理中のIOCSコール番号(なければ-1)
tst.w _DiSwc
beq @f
move.w (sp)+,sr *(EI)
@@:
cmpi.l #2,d0
bne @f
jbsr _REQUEST_SENSE
@@:
move.l d0,d6
move.l (sp)+,d0
bmi @f
movea.l d0,a1
IOCS _B_SUPER
@@:
move.l d6,d0
movem.l (sp)+,a1/d3-d6
clr.w _ScscUse
unlk a6
rts
**************************************************
*
* コマンド実行(途中終了バージョン)
*
**************************************************
.globl _scsi_cmd_hf
_scsi_cmd_hf:
link a6,#-4
move.w #1,_ScscUse
movem.l a1/d3-d6,-(sp)
move.l _SCSI_IDF,d4
SCSI__ _S_SELECT
tst.l d0
beq @f
moveq #-4,d0 *エラー
bra 1f
@@:
movea.l 12(a6),a1
move.l 8(a6),d3
move.b _SCSI_LUN,d0 **
andi.b #$1F,1(a1) **
or.b d0,1(a1) **
SCSI__ _S_CMDOUT
tst.l d0
beq @f
moveq #-3,d0 *エラー
bra 1f
@@:
move.l 16(a6),d3 *データは欲しがっているか?
tst.l d3
beq @f
*move.l 16(a6),d3
movea.l 20(a6),a1
SCSI__ _S_DATAIN_P
tst.l d0
bpl @f
lea -1(a6),a1
SCSI__ _S_STSIN
SCSI__ _S_MSGIN
moveq #-5,d0 *エラー
bra 1f
@@:
movem.l (sp)+,a1/d3-d6
move.w #1,_ScscChksw *1;STSIN MSGIN の実行待ち
*clr.w _ScscUse
unlk a6
rts
1: *======= エラー
movem.l (sp)+,a1/d3-d6
clr.w _ScscUse
unlk a6
rts
***************
*
* チェック用
*
***************
_scsi_cmd_chk:
tst.w _ScscChksw *1;STSIN MSGIN の実行待ち
bne @f
rts
@@:
_scsi_cmd_chk_s:
link a6,#-4
movem.l d0-d6/a1,-(sp)
clr.w _ScscChksw *1;STSIN MSGIN の実行待ち
lea -1(a6),a1
SCSI__ _S_STSIN
tst.l d0
beq @f
*moveq #-2,d0 *エラー
bra 1f
@@:
lea -3(a6),a1
SCSI__ _S_MSGIN
tst.l d0
beq @f
*moveq #-1,d0 *エラー
bra 1f
@@:
moveq #0,d0
move.b -3(a6),d0
swap d0
move.b -1(a6),d0
* cmpi.l #2,d0
* bne @f
* jbsr _REQUEST_SENSE
@@:
1:
clr.w _ScscUse
movem.l (sp)+,d0-d6/a1
unlk a6
rts
**************************************************
*
* TESTUNIT & REQUEST SENSE
*
**************************************************
.globl _scsi_testunit
_scsi_testunit:
link a6,#0
movem.l d3/d4,-(sp)
move.l 8(a6),d4
SCSI__ _S_TESTUNIT
cmpi.l #2,d0
bne @f
jbsr _REQUEST_SENSE
@@: movem.l (sp)+,d3/d4
unlk a6
rts
**************************************************
*
* INQUIRY & REQUEST SENSE
*
**************************************************
.globl _scsi_inquiry
_scsi_inquiry:
movem.l d3-d4,-(sp)
move.l $000c(sp),d3
move.l $0010(sp),d4
movea.l $0014(sp),a1
SCSI__ _S_INQUIRY
cmpi.l #2,d0
bne @f
jbsr _REQUEST_SENSE
@@: movem.l (sp)+,d3-d4
rts
**************************************************
*
* REZEROUNIT & REQUEST SENSE
*
**************************************************
.globl _scsi_rezerounit
_scsi_rezerounit:
move.l d4,-(sp)
move.l 8(sp),d4
SCSI__ _S_REZEROUNIT
cmpi.l #2,d0
bne @f
jbsr _REQUEST_SENSE
@@: move.l (sp)+,d4
rts
**************************************************
*
* MODESENSE/MODESELECT
*
**************************************************
.globl _scsi_modeselect
_scsi_modeselect:
movem.l d3-d4,-(sp)
move.l $000c(sp),d2
moveq #$00,d3
move.w $0012(sp),d3
move.l $0014(sp),d4
movea.l $0018(sp),a1
SCSI__ $2A * MODESELECT
movem.l (sp)+,d3-d4
rts
.globl _scsi_modesense
_scsi_modesense:
movem.l d3-d4,-(sp)
move.l $000c(sp),d2
moveq #$00,d3
move.w $0012(sp),d3
move.l $0014(sp),d4
movea.l $0018(sp),a1
SCSI__ $29 * MODESENSE
movem.l (sp)+,d3-d4
rts
**************************************************
*
* CDDEV.SYS オーディオコール
*
**************************************************
.globl _cdd_ioctrl
_cdd_ioctrl:
move.l 4(sp),d0 *com
move.l 8(sp),d1 *buf
move.l d1,-(sp) *buf
move.w d0,-(sp) *com
move.w _CddDrvNo,-(sp)
move.w #13,-(sp)
DOS _IOCTRL
lea 10(sp),sp
rts
**************************************************
*
* 掛け算! (LIBCより..)
*
**************************************************
___mulsi3::
movem.l $0004(sp),d1
move.l d1,d0
swap.w d1
or.w $0008(sp),d1
bne CLC0052
mulu.w $000a(sp),d0
rts
CLC0052:
move.l $0008(sp),d1
movea.l d3,a0
move.l d0,d2
mulu.w d1,d0
move.l d2,d3
swap.w d3
mulu.w d1,d3
swap.w d0
add.w d3,d0
swap.w d1
mulu.w d2,d1
add.w d1,d0
swap.w d0
move.l a0,d3
rts
___divsi3::
move.l $0004(sp),d1
move.l d1,d0
swap.w d0
or.w $0008(sp),d0
bne CLC008a
divu.w $000a(sp),d1
moveq.l #$00,d0
move.w d1,d0
rts
CLC008a:
move.l d1,d0
bpl CLC00a2
neg.l d0
move.l $0008(sp),d1
beq CLC00b2
bpl CLC009c
neg.l d1
CLC009a:
bra CLC0104
CLC009c:
bsr CLC0104
neg.l d0
rts
CLC00a2:
move.l $0008(sp),d1
beq CLC00b2
bpl CLC009a
neg.l d1
bsr CLC0104
neg.l d0
rts
CLC00b2:
moveq.l #$00,d0
rts
CLC00b6:
moveq.l #$01,d0
rts
CLC00ba:
moveq.l #$00,d1
divu.w d1,d0
rts
CLC00c0:
move.l d0,d2
clr.w d2
swap.w d2
divu.w d1,d2
movea.l d2,a0
move.w d0,d2
divu.w d1,d2
move.w a0,d0
swap.w d0
move.w d2,d0
rts
CLC00d6:
swap.w d0
swap.w d1
divu.w d1,d0
and.l #$0000ffff,d0
rts
___udivsi3::
move.l $0004(sp),d1
move.l d1,d0
swap.w d0
or.w $0008(sp),d0
bne CLC00fc
divu.w $000a(sp),d1
moveq.l #$00,d0
move.w d1,d0
rts
CLC00fc:
move.l d1,d0
move.l $0008(sp),d1
beq CLC00b2
CLC0104:
cmp.l d0,d1
beq CLC00b6
bhi CLC00b2
cmp.l #$00010000,d1
bcs CLC00c0
move.w d0,d2
or.w d1,d2
beq CLC00d6
movea.l d0,a1
movea.l d1,a2
cmp.l #$01000000,d1
bcc CLC0132
move.l d1,d2
swap.w d2
move.b CLC0162(pc,d2.w),d2
lsr.l d2,d1
lsr.l d2,d0
bra CLC0142
CLC0132:
move.l d1,d2
swap.w d2
lsr.w #8,d2
move.b CLC0162(pc,d2.w),d2
addq.w #8,d2
lsr.l d2,d1
lsr.l d2,d0
CLC0142:
divu.w d1,d0
and.l #$0000ffff,d0
move.l d0,d2
move.l a2,d1
mulu.w d1,d2
swap.w d1
mulu.w d0,d1
swap.w d1
clr.w d1
add.l d1,d2
cmp.l a1,d2
bls CLC0160
subq.l #1,d0
CLC0160:
rts
CLC0162:
.dc.b $00,$01,$02,$02,$03,$03,$03,$03
.dc.b $04,$04,$04,$04,$04,$04,$04,$04
.dc.b $05,$05,$05,$05,$05,$05,$05,$05
.dc.b $05,$05,$05,$05,$05,$05,$05,$05
.dc.b $06,$06,$06,$06,$06,$06,$06,$06
.dc.b $06,$06,$06,$06,$06,$06,$06,$06
.dc.b $06,$06,$06,$06,$06,$06,$06,$06
.dc.b $06,$06,$06,$06,$06,$06,$06,$06
.dc.b $07,$07,$07,$07,$07,$07,$07,$07
.dc.b $07,$07,$07,$07,$07,$07,$07,$07
.dc.b $07,$07,$07,$07,$07,$07,$07,$07
.dc.b $07,$07,$07,$07,$07,$07,$07,$07
.dc.b $07,$07,$07,$07,$07,$07,$07,$07
.dc.b $07,$07,$07,$07,$07,$07,$07,$07
.dc.b $07,$07,$07,$07,$07,$07,$07,$07
.dc.b $07,$07,$07,$07,$07,$07,$07,$07
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
CLC0262:
move.l #$7fffffff,d0
rts
CLC026a:
moveq.l #$00,d0
CLC026c:
rts
.if 0
___modsi3::
move.l $0008(sp),d1
beq CLC0262
move.l $0004(sp),d0
movea.w d1,a0
cmpa.l d1,a0
bne CLC028c
movea.w d0,a0
cmpa.l d0,a0
bne CLC028c
divs.w d1,d0
swap.w d0
ext.l d0
rts
CLC028c:
tst.l d1
bmi CLC029c
tst.l d0
bpl CLC02e4
neg.l d0
bsr CLC02e4
neg.l d0
rts
CLC029c:
tst.l d0
bmi CLC02a4
neg.l d1
bra CLC02e4
CLC02a4:
neg.l d0
neg.l d1
bsr CLC02e4
neg.l d0
rts
CLC02ae:
move.l d0,d2
swap.w d2
cmp.w d1,d2
bcc CLC02be
divu.w d1,d0
clr.w d0
swap.w d0
rts
CLC02be:
move.l d0,d2
clr.w d0
swap.w d0
divu.w d1,d0
move.w d2,d0
divu.w d1,d0
clr.w d0
swap.w d0
rts
CLC02d0:
swap.w d0
swap.w d1
divu.w d1,d0
clr.w d0
rts
___umodsi3::
move.l $0008(sp),d1
beq CLC0262
move.l $0004(sp),d0
CLC02e4:
cmp.l d0,d1
beq CLC026a
bhi CLC026c
cmp.l #$00010000,d1
bcs CLC02ae
move.w d0,d2
or.w d1,d2
beq CLC02d0
movea.l d0,a1
movea.l d1,a2
cmp.l #$01000000,d1
bcc CLC0312
move.l d1,d2
swap.w d2
move.b CLC033e(pc,d2.w),d2
lsr.l d2,d1
lsr.l d2,d0
bra CLC0322
CLC0312:
move.l d1,d2
swap.w d2
lsr.w #8,d2
move.b CLC033e(pc,d2.w),d2
addq.w #8,d2
lsr.l d2,d1
lsr.l d2,d0
CLC0322:
divu.w d1,d0
move.w d0,d2
move.l a2,d1
mulu.w d1,d2
swap.w d1
mulu.w d0,d1
swap.w d1
clr.w d1
add.l d1,d2
move.l a1,d0
sub.l d2,d0
bpl CLC033c
add.l a2,d0
CLC033c:
rts
CLC033e:
.dc.b $00,$01,$02,$02,$03,$03,$03,$03
.dc.b $04,$04,$04,$04,$04,$04,$04,$04
.dc.b $05,$05,$05,$05,$05,$05,$05,$05
.dc.b $05,$05,$05,$05,$05,$05,$05,$05
.dc.b $06,$06,$06,$06,$06,$06,$06,$06
.dc.b $06,$06,$06,$06,$06,$06,$06,$06
.dc.b $06,$06,$06,$06,$06,$06,$06,$06
.dc.b $06,$06,$06,$06,$06,$06,$06,$06
.dc.b $07,$07,$07,$07,$07,$07,$07,$07
.dc.b $07,$07,$07,$07,$07,$07,$07,$07
.dc.b $07,$07,$07,$07,$07,$07,$07,$07
.dc.b $07,$07,$07,$07,$07,$07,$07,$07
.dc.b $07,$07,$07,$07,$07,$07,$07,$07
.dc.b $07,$07,$07,$07,$07,$07,$07,$07
.dc.b $07,$07,$07,$07,$07,$07,$07,$07
.dc.b $07,$07,$07,$07,$07,$07,$07,$07
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.dc.b $08,$08,$08,$08,$08,$08,$08,$08
.endif